package one.stand.controller;

import one.stand.model.ResultModel;
import one.stand.request.*;
import one.stand.response.BusinessCardResponse;
import one.stand.response.SunCodeResponse;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author Administrator
 */
@RestController
@RequestMapping("businessCard")
public class BusinessCardController extends BaseController {

    /**
     * 名片详情
     *
     * @param request
     * @return
     */
    @PostMapping("cardDetails")
    public ResultModel<BusinessCardResponse> cardDetails(@RequestBody BusinessCardRequest request) {
        return businessCardService.cardDetails(request);
    }

    /**
     * 添加我的名片
     *
     * @param request
     * @return
     */
    @PostMapping("createCard")
    public ResultModel<Boolean> createCard(@RequestBody BusinessCardRequest request) {
        return businessCardService.createCard(request);
    }

    /**
     * 判断是否有名片或者公司
     *
     * @param request
     * @return
     */
    @PostMapping("isCreateCompany")
    public ResultModel<Boolean> isCreateCompany(@RequestBody TokenRequest request) {
        return businessCardService.isCreateCompany(request);
    }

    /**
     * 名片列表
     *
     * @param request
     * @return
     */
    @PostMapping("seeDetail")
    public ResultModel<List<BusinessCardResponse>> seeDetail(@RequestBody BusinessCardRequest request) {
        return businessCardService.seeDetail(request);
    }

    /**
     * 修改名片
     *
     * @param request
     * @return
     */
    @PostMapping("updateCard")
    public ResultModel<Boolean> updateCard(@RequestBody BusinessCardRequest request) {
        return businessCardService.updateCard(request);
    }

    /**
     * 查询用户自己的名片
     *
     * @param request
     * @return
     */
    @PostMapping("getUserCard")
    public ResultModel getUserCard(@RequestBody BusinessCardRequest request) {
        return businessCardService.getUserCard(request);
    }

    /**
     * 置顶操作
     *
     * @param request
     * @return
     */
    @PostMapping("isTop")
    public ResultModel<Boolean> isTop(@RequestBody SeeRecordRequest request) {
        return businessCardService.isTop(request);
    }

    /**
     * 删除浏览记录
     */
    @PostMapping("delSeeCard")
    public ResultModel delSeeCard(@RequestBody SeeRecordRequest request) {
        return businessCardService.delSeeCard(request);
    }

    /**
     * 点赞操作
     */
    @PostMapping("doThumbs")
    public ResultModel doThumbs(@RequestBody SeeRecordRequest request) {
        return businessCardService.doThumbs(request);
    }

    /**
     * 得到名片二维码
     */
    @PostMapping("getWxTwoCode")
    public ResultModel getWxTwoCode(@RequestBody BusinessCardRequest request) {
        return businessCardService.getWxTwoCode(request);
    }

    /**
     * 添加通话记录
     */
    @PostMapping("addCallsRecord")
    public ResultModel addCallsRecord(@RequestBody CallsPhoneRecordRequest request) {
        return businessCardService.addCallsRecord(request);
    }

    /**
     * 根据用户ID查询用户信息（批量操作）
     */
    @PostMapping("getUserInfo")
    public ResultModel<List<BusinessCardResponse>> getUserInfo(@RequestBody  BusinessCardRequest request) {
        return businessCardService.getUserInfo(request);
    }

    /**
     * 得到太阳码参数
     */
    @PostMapping("getSunCode")
    public ResultModel<SunCodeResponse> getSunCode(@RequestBody SunCodeRequest request) {
        return sunCodeService.getSunCode(request);
    }
}
